<?php
include("../seguranca.php"); // Inclui o arquivo com o sistema de segurança
protegePagina(); // Chama a função que protege a página
?>
<!DOCTYPE html lang="pt-BR">
<head>    
<link href="../style/esquema.css" rel="stylesheet">
<script type="text/javascript" src="../script/script.js"></script>
<meta charset="UTF-8">
<title>Wise-Car</title>
</head>

<body>
<div align="right" class="geral">
   	<div id="content" align="center">
    <div class="logoff">
    <a href="http://localhost/wisecar/view/index.php"><input class="botaoSair" type="button" value="Home"></a>
    <a href="http://localhost/wisecar/index.php"><input class="botaoSair" type="button" value="Logoff"></a>
    </div>
    <h1>Editar Cliente</h1>
    <?php
	$query = "select * from pessoas,clientes where pessoas.id = clientes.Pessoas_id and BINARY pessoas.Nome = '".$_POST['NomeCliente']."'";
	$result = mysql_query($query);
	$row = mysql_fetch_assoc($result);
    ?>
    <form action="../controller/editarCliente.php" method="post">
				<table align="center" cellpadding="2" cellspacing="2">
                <tr><td>
                <input type="hidden" name="idCliente" value="<?php echo $row['id']?>">
                </td><td>Dados Antigos</td><td>Novos Dados</td></tr>
					<tr>
						<td align="left">Nome </td>
						<td><input type="text" disabled value="<?php echo $_POST['NomeCliente']; ?>" ></td>
						<td><input type="hidden" disabled  name="nome"></td>
					</tr>
					<tr>
						<td align="left">CPF</td>
						<td><input type="text" disabled value ="<?php echo $row['CPF'];?>" maxlength="14"/></td>
						<td><input type="text" name="cpf" id="Cpf" onKeyPress="return isNumber(this);" onKeyUp="return mascaraCpf(this.value);" maxlength="14"/></td>
					</tr>
					<tr>
						<td align="left">RG</td>
						<td><input type="text" value="<?php echo $row['RG'];?>" disabled maxlength="20"/></td>
						<td><input type="text"  name="rg" id="rgID" onkeypress="return isNumber(this)" maxlength="20"/></td>
					</tr>
					<tr>
						<td align="left">Passaporte</td>
						<td><input type="text" disabled value="<?php echo $row['passaporte'];?>"></td>
						<td><input type="text" name="passaporte" id="passaporteID"></td>
					</tr>
					<tr>
						<td align="left">Data Nascimento</td>
						<td><input type="date" disabled value="<?php echo $row['dataNascimento'];?>"></td>
						<td><input type="date" name="dataNasc" id="dataNascID"></td>
					</tr>
					<tr>
						<td align="left">E-mail:</td>
						<td><input type="email" disabled value="<?php echo $row['email'];?>"></td>
						<td><input type="email" name="email" id="emailID"></td>
					</tr>
					<tr>
						<td align="left">Telefone Fixo:</td>
						<td><input type="text" disabled value="<?php echo $row['Telefone_fixo']; ?>"></td>
						<td><input type="text" name="telFixo" onKeyPress="return isNumber(this);" id="telFixoID"></td>
					</tr>
					<tr>
						<td align="left">Celular:</td>
						<td><input type="text"  disabled value="<?php echo $row['Telefone_celular']; ?>"></td>
						<td><input type="text" name="celular" onKeyPress="return isNumber(this);" id="celularID"></td>
					</tr>
					<tr>
						<td align="left">Endereço</td>
						<td><input type="text" disabled value="<?php echo $row['Rua']; ?>"></td>
						<td><input type="text" maxlength="64" name="endereco" id="enderecoID"></td>
					</tr>
					<tr>
						<td align="left">Profissão</td>
						<td><input type="text" disabled value="<?php echo $row['profissao']; ?>"></td>
						<td><input type="text"  name="profissao" id="profissaoID"></td>
					</tr>
					<tr>
						<td align="left">End. Profissional</td>
						<td><input type="text" disabled value="<?php echo $row['endProfissional']; ?>"></td>
						<td><input type="text" name="endProfissional" id="endProfID"></td>
					</tr>
					<tr>
						<td align="left">Faixa Salarial</td>
						<td><input type="text" disabled value="<?php echo $row['faixaSalarial']; ?>"></td>
						<td><input type="text" name="faixaSalarial" id="faixaSalarialID"></td>
					</tr>
					<tr><td colspan="3" align="center">
							<input type="submit" value="Enviar">
							<input type="reset" value="Limpar">
						</td></tr>		
				</table>
			</form>
    </div>
</div>
</body>
</html>